﻿<phone:PhoneApplicationPage
    x:Class="Social_Celebrities.feedPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:converter="clr-namespace:Social_Celebrities"
    xmlns:LART="clr-namespace:LART.Controls;assembly=LART.Controls.ScrollableTextBlock"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False">

    <phone:PhoneApplicationPage.Resources>
        <Style TargetType="ContentControl" x:Key="HintCustomStyle">
            <Setter Property="Foreground" Value="Gray"/>
        </Style>
        <converter:ImageFromRssText2 x:Key="ImageFromRssText2" />
        <converter:PlainText x:Key="PlainText" />
        <converter:RssTextTrimmer1 x:Key="RssTextTrimmer1" />
        <converter:ImageFromRssText x:Key="ImageFromRssText"></converter:ImageFromRssText>
        <converter:ControlVisibility x:Key="ControlVisibility"></converter:ControlVisibility>
    </phone:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot" Background="{StaticResource bipivot}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="90"/>
        </Grid.RowDefinitions>
       
            <ListBox Name="FaceListBox" Grid.Row="0" Visibility="Collapsed" Margin="10,10,10,0">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                        <Image Grid.Row="0" Margin="0,10,0,0" ImageOpened="Image_ImageOpened" ImageFailed="Image_ImageFailed" Source="{Binding item.Summary.Text , Converter={StaticResource ImageFromRssText2}}" Visibility="{Binding item.Summary.Text , Converter={StaticResource ControlVisibility}}" Tag="Binding Title" Stretch="Fill" Width="100" Height="100"></Image>
                            <TextBlock Margin="10,10,10,0" Grid.Row="1" Text="{Binding item.Summary.Text, Converter={StaticResource PlainText}}" HorizontalAlignment="Left" x:Name="tblkDescription" VerticalAlignment="Bottom" Width="457" TextWrapping="Wrap" Foreground="White" />
                        <ListBox Name="CommentsList" Grid.Row="2" Visibility="{Binding comments,TargetNullValue=Collapsed}" Margin="10,10,10,10" ItemsSource="{Binding comments}" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Margin="10,20,0,0">
                                            <TextBlock x:Name="TbName" Text="{Binding Name}"></TextBlock>
                                            <TextBlock x:Name="Tbcomment" Text="{Binding Comment}"></TextBlock>
                                            <TextBlock x:Name="TbDate" Text="{Binding Date}"></TextBlock>
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                            <TextBox x:Name="txtComment" Grid.Row="3" Width="400" Loaded="txtComment_Loaded"></TextBox>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

        <ListBox Name="TweetListBox" Grid.Row="0" Visibility="Collapsed" Margin="10,10,10,0">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                           
                        </Grid.RowDefinitions>
                        <TextBlock Margin="10,10,10,0" Grid.Row="0" Text="{Binding item.Text}" HorizontalAlignment="Left" x:Name="feedSummary" VerticalAlignment="Bottom" Width="457" TextWrapping="Wrap" Foreground="White" />
                        <ListBox Name="CommentsList1" Grid.Row="1"  Margin="10,10,10,10"  Visibility="{Binding comments,TargetNullValue=Collapsed}" ItemsSource="{Binding comments}"  ScrollViewer.VerticalScrollBarVisibility="Disabled">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Margin="10,20,0,0">
                                        <TextBlock x:Name="TbName" Text="{Binding User.Name}"></TextBlock>
                                        <TextBlock x:Name="Tbcomment" Text="{Binding Text}"></TextBlock>
                                        <TextBlock x:Name="TbDate" Text="{Binding CreatedDate}"></TextBlock>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <toolkit:PhoneTextBox Loaded="txtComment1_Loaded"  LengthIndicatorVisible="False" Grid.Row="2"  Foreground="Gray" BorderBrush="Gray" Width="400" Height="77"   x:Name="txtComment1"  HintStyle="{StaticResource HintCustomStyle}"></toolkit:PhoneTextBox>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <ListBox Name="BlogListBox" Grid.Row="0" Visibility="Collapsed" Margin="10,10,10,0">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <LART:ScrollableTextBlock Name="feedSummary" Grid.Row="0" Margin="10,10,10,0"  Text="{Binding item.Summary.Text, Converter={StaticResource RssTextTrimmer1}}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="457" MinHeight="550" Foreground="White" />
                        <TextBox x:Name="txtComment2" Loaded="txtComment2_Loaded" Grid.Row="1" Width="400"></TextBox>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True">
            <shell:ApplicationBarIconButton IconUri="/Images/post.png" Text="post" Click="ApplicationBarIconButton_Click_1"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>